<html>
<head>
<title>DragMath Documentation - Adding a function/operator</title>
</head>
<body>

<font size="2"; style="font-family: Arial;">

<h2><span style=" color: #000099;"><strong>Adding a function/operator</strong></span></h2>

<p>
The code can be easily modified and recompiled to add additional operators and functions.
 </p><p>
However, they must adhere to the standard display layout shown below:
</p><p>
Operator:
<br>
<IMG alt="" hspace=0 src="img/plus.jpg" align=bottom border=0>
</p><p>
Function:
<br>
<IMG alt="" hspace=0 src="img/sin.jpg" align=bottom border=0>
</p><p>
The steps to adding one:
</p>
<ol>

 <LI>A new element in the CompConfig.xml, which is located in the Display package. The element must be given a unique name as the name of the object. A unique ID number, by simply choosing the next available ID number. A group number as follows:
<br>&nbsp;N-ary operator - 1
<br>&nbsp;Binary Operator - 2
<br>&nbsp;Function - 3
<br>&nbsp;The name of the GIF file that holds a transparent image of the object, of size &nbsp;16x16, 24x24 or 32x32 pixels.<BR>&nbsp;The text of the element should hold the 
  characters that represent the object. 
<LI>A new JButton placed on one of the tabs, in the MainApplet.java file. This button can have Text or an Icon to inform the user what it is. The JButton must have the name field set to 'ID-Name' e.g. for Addition this is '2-Add'. 
<LI>A new element in the language file you intend to use, with the same element name as in the CompConfig.xml file. The text of the element should be a description of the object for use in the status bar of the program.
<LI>The array &#8216;inputComponents&#8217; should be initialised to the size of the highest ID number now in CompConfig.xml. This line of code is found near the start of the init() method in the MainApplet.java file, in the Display package.
<LI>The Precedence.java file in the Tree package should be adjusted, so the &#8216;value&#8217; array is initialised to the size of the highest ID number now in CompConfig.xml, and the precedence of the new object should be set if required.
<LI>An entry in each format XML file will be required for the new object. For details on how to do this see <A href="newformat.html">here</A>.

</font>

</body>
</html>